package com.example.imoocmusicdemo.activitys;


import android.app.Activity;
import android.support.annotation.IdRes;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.imoocmusicdemo.R;

public class BaseActivity extends Activity {

    private ImageView mIvBack,mIvMe,mItMessage,mItGo,iTbMine,iTbTogether;
    private TextView mIvTitle,mItTitle;



    //封装一个findbyid
    protected <T extends View> T fd (@IdRes int id) {
        return findViewById(id);
    }

    //顶部条
    protected void initNavBar (boolean isShowBack, String title,boolean isShowMe) {
        mIvBack = fd(R.id.iv_back);
        mIvTitle = fd(R.id.iv_title);
        mIvMe = fd(R.id.iv_me);

        mIvBack.setVisibility(isShowBack ? View.VISIBLE : View.GONE);
        mIvMe.setVisibility(isShowMe ? View.VISIBLE : View.GONE);
        mIvTitle.setText(title);

        mIvBack.setOnClickListener(new View.OnClickListener(){

            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
    }



}
